import {act} from 'react-test-renderer';
import * as types from '../action/ActionTypes';

const defaultState = {
  config: '',
  coins: '',
  manager: '',
  signinNFT: '',
  gasSymbol: '',
  swapSymbol: '',
  currentChainId: 0,
};

export default function chainReducer(state = defaultState, action) {
  switch (action.type) {
    case types.CHAIN_CONFIG:
      return {
        ...state,
        config: action.data.config,
        coins: action.data.coins,
        signinClub: action.data.signinClub,
        manager: action.data.manager,
        proxy: action.data.proxy,
        signinNFT: action.data.signinNFT,
        gasSymbol: action.data.symbol,
        swapSymbol: action.data.swapSymbol,
      };
    case types.UPDATE_WALLET_BALANCE:
      return {
        ...state,
        coins: action.coins,
      };
    case types.UPDATE_CHAIN_ID:
      console.log('============');
      console.log(action);
      return {
        ...state,
        currentChainId: action.data.currentChainId,
      };
    default:
      return state;
  }
}
